<?php
/**
 * Created by Command.
 * User: Vito
 */

declare (strict_types = 1);

namespace app\logic;

use app\model\Building;
use app\model\Room;

class BuildingLogic extends BaseLogic
{

    /**
     * 设置模型
     * @return string
     */
    protected function getModelName(): string
    {
        return Building::class;
    }

    /**
     * @Description: 修改楼房时，将对应楼房的房间也进行修改
     * @author: xiayu <cb1071403016@126.com>
     * @Date: 2022-12-03 09:48:42
     * @version: 1.0.0
     * @return [type]
     */
    public function updateRoom($id, $params){
        
        $where['building_number'] = $id;
        $updateData = [
            'housing_id' => $params['housing_id']
        ];
        Room::where($where)->update($updateData);
    }
    
}
